package main

import (
	"basic/router"
	"fmt"
	"log"
	"syscall"
	"time"

	_ "basic/docs"
	"github.com/fvbock/endless"
)

func main() {
	endPoint := fmt.Sprintf(":%d", 8080)
	r := router.SetupRouter()
	server := endless.NewServer(endPoint, r)
	server.BeforeBegin = func(add string) {
		log.Printf("Actual pid is %d", syscall.Getpid())
	}
	time.Sleep(10 * time.Microsecond)
	err := server.ListenAndServe()
	if err != nil {
		log.Printf("Server err: %v", err)
	}
}
